﻿using System;
using System.Collections.Generic;
using UnityEngine;

namespace ParticlePlayground
{
	// Token: 0x020001A5 RID: 421
	public class MeshParticles : PlaygroundParticlesC
	{
		// Token: 0x060009AA RID: 2474 RVA: 0x00048AB0 File Offset: 0x00046CB0
		public static PlaygroundParticlesC CreateMeshParticles(Mesh[] meshes, Texture2D[] textures, Texture2D[] heightMap, string name, Vector3 position, Quaternion rotation, float particleScale, Vector3[] offsets, Material material)
		{
			PlaygroundParticlesC playgroundParticlesC = PlaygroundParticlesC.CreateParticleObject(name, position, rotation, particleScale, material);
			playgroundParticlesC.states = new List<ParticleStateC>();
			int[] array = new int[meshes.Length];
			for (int i = 0; i < textures.Length; i++)
			{
				array[i] = meshes[i].vertexCount;
			}
			playgroundParticlesC.particleCache = new ParticleSystem.Particle[array[PlaygroundC.Largest(array)]];
			playgroundParticlesC.shurikenParticleSystem.Emit(playgroundParticlesC.particleCache.Length);
			playgroundParticlesC.shurikenParticleSystem.GetParticles(playgroundParticlesC.particleCache);
			for (int i = 0; i < meshes.Length; i++)
			{
				playgroundParticlesC.states.Add(new ParticleStateC());
				playgroundParticlesC.states[0].ConstructParticles(meshes[i], textures[i], particleScale, offsets[i], "State " + i, null);
			}
			playgroundParticlesC.UpdateSystem();
			PlaygroundC.particlesQuantity++;
			return playgroundParticlesC;
		}

		// Token: 0x060009AB RID: 2475 RVA: 0x00048BA8 File Offset: 0x00046DA8
		public static void Add(PlaygroundParticlesC meshParticles, Mesh mesh, float scale, Vector3 offset, string stateName, Transform stateTransform)
		{
			meshParticles.states.Add(new ParticleStateC());
			meshParticles.states[meshParticles.states.Count - 1].ConstructParticles(mesh, scale, offset, stateName, stateTransform);
		}

		// Token: 0x060009AC RID: 2476 RVA: 0x00048BE0 File Offset: 0x00046DE0
		public static void Add(PlaygroundParticlesC meshParticles, Mesh mesh, Texture2D texture, float scale, Vector3 offset, string stateName, Transform stateTransform)
		{
			meshParticles.states.Add(new ParticleStateC());
			meshParticles.states[meshParticles.states.Count - 1].ConstructParticles(mesh, texture, scale, offset, stateName, stateTransform);
		}
	}
}
